﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EwcControlTest
{
    public partial class EnhancedDropDowns : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblResults1.Visible = false;
            string skin = "";
            if (((Site1)Master).ApplySkin)
                skin = "MySkin";
            EnhancedDropDown1.CssClass = skin;
            EnhancedDropDown2.CssClass = skin;
            EnhancedDropDown3.CssClass = skin;
            EnhancedDropDown4.CssClass = skin;
            if (!Page.IsPostBack)
            {
                List<UsState> states = Site1.GetUsStatesList();
                EnhancedDropDown1.DataSource = states;
                EnhancedDropDown1.DataTextField = "Name";
                EnhancedDropDown1.DataValueField = "Abbreviation";
                EnhancedDropDown3.SetDefaultRow("Select A State...", "0");
                EnhancedDropDown1.DataBind();
                EnhancedDropDown1.SelectedValue = "NE";
                EnhancedDropDown1.SelectedValue = "NotFound";

                EnhancedDropDown2.DataSource = states;
                EnhancedDropDown2.DataTextField = "Name";
                EnhancedDropDown2.DataValueField = "Abbreviation";
                EnhancedDropDown2.DataBind();

                EnhancedDropDown4.DataSource = states;
                EnhancedDropDown4.DataTextField = "Name";
                EnhancedDropDown4.DataValueField = "Abbreviation";
                EnhancedDropDown4.DataBind();

                EnhancedDropDown3.DataSource = states;
                EnhancedDropDown3.DataTextField = "Name";
                EnhancedDropDown3.DataValueField = "Abbreviation";
                EnhancedDropDown3.DataBind();
                EnhancedDropDown3.SetDefaultRow("Select A State...", "0");
            }
        }
        protected void SelectedIndexChanged(object sender, EventArgs e)
        {
            lblResults1.Text = "You Selected: " + EnhancedDropDown3.SelectedValue + " - " + EnhancedDropDown3.SelectedItem.Text;
            lblResults1.Visible = true;
        }
    }
}
